
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>模板状态管理</title>
    <style>
        body, a {
            color: #333;
        }

        a {
            border:none;
            display: inline-block;
            text-decoration: none;
        }

        em {
            font-style: normal;
        }

        .complete a {
            color:green;
        }

        .complete a:hover {
            text-decoration: underline;
        }

        .progressing a {
            cursor: default;
            color:orange;
        }

        .disabled a {
            cursor: default;
            color:gray;
        }

        h3 em:before {
            content: '';
            display: inline-block;
            width: 30px;
            height: 18px;
            vertical-align: middle;
            position: relative;
            top:-2px;
        }

        h3 .complete:before {
            background-color: green;
        }

        h3 .progressing:before {
            background-color: orange;
        }

        h3 .disabled:before {
            background-color: gray;
        }

        li {
            margin-top: 8px;
        }

        a.download {
            color: #333;
            margin-left: 4px;
        }

        a.download:hover {
            color: green;
        }
    </style>
</head>
<body>
    <h3>
        静态页面完成进度：<span id="complete">0</span>/20
        <span style="font-weight: normal; font-size: 14px; margin-left:20px;">
            状态说明 :
            <em class="complete">
                已完成
            </em>
            <em class="progressing">
                开发中
            </em>
            <em class="disabled">
                未开始
            </em>
        </span>
    </h3>
    <ol id="data">
        <li class="complete">
            <a href="./1/index.html">1</a>
        </li>
        <li class="complete">
            <a href="./2/index.html">2</a>
        </li>
        <li class="complete">
            <a href="./3/index.html">3</a>
        </li>
        <li class="complete">
            <a href="./4/index.html">4</a>
        </li>
        <li class="complete">
            <a href="./5/index.html">5</a>
        </li>
        <li class="complete">
            <a href="./6/index.html">6</a>
        </li>
        <li class="complete">
            <a href="./7/index.html">7</a>
        </li>
        <li class="complete">
            <a href="./8/index.html">8</a>
        </li>
        <li class="progressing">
            <a href="./9/index.html">9</a>
        </li>
        <li class="disabled">
            <a>页面XXXX</a>
        </li>
        <li class="disabled">
            <a>页面XXXX</a>
        </li>
        <li class="disabled">
            <a>页面XXXX</a>
        </li>
        <li class="disabled">
            <a>页面XXXX</a>
        </li>
        <li class="disabled">
            <a>页面XXXX</a>
        </li>
        <li class="disabled">
            <a>页面XXXX</a>
        </li>
        <li class="disabled">
            <a>页面XXXX</a>
        </li>
        <li class="disabled">
            <a>页面XXXX</a>
        </li>
        <li class="disabled">
            <a>页面XXXX</a>
        </li>
        <li class="disabled">
            <a>页面XXXX</a>
        </li>
        <li class="disabled">
            <a>页面XXXX</a>
        </li>
    </ol>

    <script>
    var count = 0;
    var complete = document.getElementById('complete');
    var data = document.getElementById('data');
    var childs = data.childNodes;
    var len = childs.length;
    for(var i=0; i < len; i++){
        if(childs[i].nodeName === 'LI' && childs[i].className.indexOf('complete') !== -1){
            count++
        }
    }
    complete.innerHTML = count;
    </script>
</body>
</html>